home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / Protocol_Handbook_Part1.txt < prev    next >
Text File  |  1999-03-16  |  18KB  |  463 lines

  1. -------------------------------------------------------------------
  2. The Protocol Handbook
  3. -------------------------------------------------------------------
  4. Part 1-By rift 10/14/98
  5.  
  6. Preface
  7.  
  8. This guide explains the elements of Protocols relating to the Internet. Many client/server applications rely on protocols, for example, Netscape Navigator or Microsoft Internet Explorer.  These two applications use the http protocol to send and recieve data between the server and the client.  The client sends a request to the http server, listening on port 80.  To make it simple, the client sais ‘may I have this file?’ and the server replies, most likely dumping the page back to the client.  The client will then take the data sent back from the server, parse it, and display it for the user on a normal page.
  9.  
  10. Clients
  11.  
  12. The client is the application that communicates with the server.  Usually a client will create a virtual-circuit connection with the server, then start communicating.  We show an example here, where the client is sending information relating to nickname/ident and the server is acknowledging that it recieved that info.
  13.  
  14. Send 16 bytes.
  15. <00000000< NICK hax0r
  16.  
  17. Send 42 bytes.
  18. <00000010< USER hax0r 32 . :I am an elite hax0r
  19.  
  20. (Server communicates with the client; recognizes that the requested nick is in use and sends data back in which the irc client will interpret)
  21.  
  22. Receive 60 bytes.
  23. >00000000> :irc.hax0r.bm 433 * hax0r :Nickname is already in 
  24. >00000036> use.
  25.   
  26. Send 16 bytes.
  27. <0000003A< NICK hax0r1
  28.  
  29. (Handshaking stage complete...)
  30. Receive 1099 bytes.
  31. >0000003C> :irc.hax0r.bm 001 hax0r1: Welcome to IRC.
  32.  
  33. So we have completed the handshaking stage.  The server waits for the responses from the client, and once succesfully initiated, the client goes on with its buisness.
  34.  
  35. More advanced handshaking
  36.  
  37. Here we get down to the dirty work.  Between the client and server there are packets sent, and in those packets contain flags.  The most commonly used flags are:
  38.  
  39. SYN - Initiate a virtual circuit connection with the destination host/server.  We use the three way tcp handshaking procedure to connect. Both the SYN and ACK flags are stated in a packet:
  40.  
  41. SYN=1/ACK=0: Opens a connection
  42. SYN=1/ACK=1: Open connection acknowledgment request
  43. SYN=0/ACK=1: Just plain acknowledgment packet or data packet
  44.  
  45. ACK - ACK is used to state that the acknowledgment number field is valid.
  46.  
  47. RST - RST resets the connection because a. the server returned an error or b. the client created an error its self.
  48.  
  49. FIN - FIN terminates the connection(vcircuit).  Both client and server sides must agree on terminating the connection; otherwise an application might unexpectedly drop the connection for no reason.
  50.  
  51. URG - URG is used to send OOB (Out-of-band-data) to the server without waiting for the server to process octets in the stream.  Octets are every 8th bit within a byte. NetBIOS produces a problem within URG processing: it cannot handle a sequence of data at any length.  This is known as the “winnuke” attack - (http://www.rootshell.com/archive-j457nxiqi3gq59dv/199707/winnuke.c.html) 
  52.  
  53.  
  54. Address Classes
  55.  
  56.  
  57. You've probably heard people saying "Class C Net" or "Class A Net" - These are address classes.   Address Classes are used to define the number of nodes on a specific network; the table follows below:
  58.  
  59. Class A - 127 networks, 16,777,214 Nodes.
  60. Class B - 16,383 networks, 65,534 Nodes.
  61. Class C - 2,097,151 networks, 254 Nodes.
  62.  
  63. The most common network that you will find is the Class C network, which many schools/private buisnesses use.  Class A nets are for HUGE companies like AOL, which need more IP Addresses than Bill Clinton needs ugly women. (um that was a bad joke)
  64.  
  65.  
  66. Protocol Definitions
  67.  
  68. Here I will explain many popular procotols that we use, like FTP or IRC.
  69.  
  70. TCP - Transfer Control Protocol.  TCP relies on IP to get the info right; it is also used to make sure none of the packets sent are dropped by mistake.  TCP is what delivers your packets: it is obviously needed for most of our advanced client/server applications.  Once IP handles where the data is to be sent, TCP goes to work and delivers the data in its form. Here is a basic outline of a TCP packet:
  71.  
  72. -----------------
  73. Source IP Address\
  74. -----------------    \__
  75. Destination IP Address |
  76. --------------------/
  77. Protocol                                        /
  78. ------------------/
  79. TCP Length                        /
  80. ----------------/
  81. TCP Header                 /
  82. --------------/
  83. Data                                    \_____
  84. ---------------------|
  85.  
  86.  
  87. Some ports are listed here...
  88.  
  89. 1    tcpmux - TCP Port Service Multiplexer
  90. 2    compressnet - Management Utility
  91. 3    compressnet - Compression Process
  92. 5    rje - Remote Job Entry
  93. 7    echo
  94. 9    discard
  95. 11    systat - Active Users
  96. 13    daytime
  97. 17    qotd - Quote of the Day
  98. 18    msp - Message Send Protocol
  99. 19    chargen - Character Generator
  100. 20    ftp-data - File Transfer [Default Data]
  101. 21    ftp - File Transfer [Control]
  102. 23    telnet
  103. 24    any private mail system
  104. 25    smtp - Simple Mail Transfer
  105. 27    nsw-fe - NSW User System FE
  106. 29    msg-icp
  107. 31    msg-auth - MSG Authentication
  108. 33    dsp - Display Support Protocol
  109. 35    any private printer server
  110. 37    time
  111. 38    rap - Route Access Protocol
  112. 39    rlp - Resource Location Protocol
  113. 41    graphics
  114. 42    nameserver - Host Name Server
  115. 43    nicname - Who Is
  116. 44    mpm-flags - MPM FLAGS Protocol
  117. 45    mpm - Message Processing Module [recv]
  118. 46    mpm - Message Processing Module [default send]
  119. 47    ni-ftp
  120. 48    auditd - Digital Audit Daemon
  121. 49    login - Login Host Protocol
  122. 50    re-mail-ck - Remote Mail Checking Protocol
  123. 51    la-maint - IMP Logical Address Maintenance
  124. 52    xns-time - XNS Time Protocol
  125. 53    domain - Domain Name Server
  126. 54    xns-ch - XNS Clearinghouse
  127. 55    isi-gl - ISI Graphics Language
  128. 56    xns-auth - XNS Authentication
  129. 57    any private terminal access
  130. 58    xns-mail - XNS Mail
  131. 59    any private file service
  132. 61    ni-mail
  133. 62    acas - ACA Services
  134. 64    covia - Communications Integrator (CI)
  135. 65    tacacs-ds - TACACS-Database Service
  136. 67    bootps - Bootstrap Protocol Server
  137. 68    bootpc - Bootstrap Protocol Client
  138. 69    tftp - Trivial File Transfer
  139. 70    gopher
  140. 71    netrjs-1 Remote Job Service
  141. 72    netrjs-2 Remote Job Service
  142. 73    netrjs-3 Remote Job Service
  143. 74    netrjs-4 Remote Job Service
  144. 75    any private dial out service
  145. 76    deos - Distributed External Object Store
  146. 77    any private RJE service
  147. 78    vettcp
  148. 79    finger
  149. 80    www-http - World Wide Web HTTP
  150. 81    host2-ns - HOSTS2 Name Server
  151. 82    xfer - XFER Utility
  152. 83    mit-ml-dev
  153. 84    ctf - Common Trace Facility
  154. 85    mit-ml-dev
  155. 86    mfcobol - Micro Focus Cobol
  156. 87    any private terminal link
  157. 88    kerberos
  158. 89    su-mit-tg - SU/MIT Telnet Gateway
  159. 90    dnsix - DNSIX Security Attribute Token Map
  160. 91    mit-dov - MIT Dover Spooler
  161. 92    npp - Network Printing Protocol
  162. 93    dcp - Device Control Protocol
  163. 94    objcall - Tivoli Object Dispatcher
  164. 95    supdup
  165. 96    dixie - DIXIE Protocol Specification
  166. 97    swift-rvf - Swift Remote Virtual File Protocol
  167. 98    tacnews
  168. 99    metagram - Metagram Relay
  169. 100    newacct - [unauthorized use]
  170. 101    hostname - NIC Host Name Server
  171. 102    iso-tsap
  172. 103    gppitnp - Genesis Point-To-Point Trans Net
  173. 104    acr-nema - ACR-NEMA Digital Imag. & Comm. 300
  174. 105    csnet-ns - Mailbox Name Nameserver
  175. 106    3com-tsmux
  176. 107    rtelnet - Remote Telnet Service
  177. 108    snagas - SNA Gateway Access Server
  178. 109    pop2 - Post Office Protocol - Version 2
  179. 110    pop3 - Post Office Protocol - Version 3
  180. 111    sunrpc - SUN Remote Procedure Call
  181. 112    mcidas - McIDAS Data Transmission Protocol
  182. 113    auth - Authentication Service
  183. 114    audionews - Audio News Multicast
  184. 115    sftp - Simple File Transfer Protocol
  185. 116    ansanotify - ANSA REX Notify
  186. 117    uucp-path - UUCP Path Service
  187. 118    sqlserv - SQL Services
  188. 119    nntp - Network News Transfer Protocol
  189. 120    cfdptkt
  190. 121    erpc - Encore Expedited Remote Pro.Call
  191. 122    smakynet
  192. 123    ntp - Network Time Protocol
  193. 124    ansatrader - ANSA REX Trader
  194. 125    locus-map - Locus PC-Interface Net Map Ser
  195. 126    unitary - Unisys Unitary Login
  196. 127    locus-con - Locus PC-Interface Conn Server
  197. 128    gss-xlicen - GSS X License Verification
  198. 129    pwdgen - Password Generator Protocol
  199. 130    cisco-fna - cisco FNATIVE
  200. 131    cisco-tna - cisco TNATIVE
  201. 132    cisco-sys - cisco SYSMAINT
  202. 133    statsrv - Statistics Service
  203. 135    loc-srv - Location Service
  204. 136    profile - PROFILE Naming System
  205. 137    netbios-ns - NETBIOS Name Service
  206. 138    netbios-dgm - NETBIOS Datagram Service
  207. 139    netbios-ssn - NETBIOS Session Service
  208. 140    emfis-data - EMFIS Data Service
  209. 141    emfis-cntl - EMFIS Control Service
  210. 142    bl-idm - Britton-Lee IDM
  211. 143    imap2 - Interim Mail Access Protocol v2
  212. 144    news
  213. 145    uaac
  214. 146    iso-tp0
  215. 147    iso-ip
  216. 148    cronus - CRONUS-SUPPORT
  217. 149    aed-512 - AED 512 Emulation Service
  218. 150    sql-net
  219. 151    hems
  220. 152    bftp - Background File Transfer Program
  221. 153    sgmp
  222. 154    netsc-prod
  223. 155    netsc-dev
  224. 156    sqlsrv - SQL Service
  225. 157    knet-cmp - KNET/VM Command/Message Protocol
  226. 158    pcmail-srv - PCMail Server
  227. 159    nss-routing
  228. 160    sgmp-traps
  229. 161    snmp - Simple Network Managment Protocol
  230. 162    snmptrap - Simple Network Managment Protocol Trap
  231. 163    cmip-man - CMIP/TCP Manager
  232. 164    cmip-agent - CMIP/TCP Agent
  233. 165    xns-courier - Xerox
  234. 166    s-net - Sirius Systems
  235. 167    namp
  236. 168    rsvd
  237. 169    send
  238. 170    print-srv - Network PostScript
  239. 171    multiplex - Network Innovations Multiplex
  240. 172    cl/1 - Network Innocations CL/1
  241. 173    xyplex-mux - Xyplex
  242. 174    mailq
  243. 175    vmnet
  244. 176    genrad-mux
  245. 177    xdmcp - X Display Manager Control Protocol
  246. 178    nextstep - NextStep Window Server
  247. 179    bgp - Border Gateway Protocol
  248. 180    ris - Intergraph
  249. 181    unify
  250. 182    audit - Unisys Audit SITP
  251. 183    ocbinder
  252. 184    ocserver
  253. 185    remote-kis
  254. 186    kis - KIS Protocol
  255. 187    aci - Application Communication Interface
  256. 188    mumps - Plus Five's MUMPS
  257. 189    qft - Queued File Transport
  258. 190    gacp - Gateway Access Protocol
  259. 191    prospero - Prospero Directory Service
  260. 192    osu-nms - OSU Network Monitoring System
  261. 193    srmp - Spider Remote Monitoring Protocol
  262. 194    irc - Internet Relay Chat
  263. 195    dn6-nlm-aud - DNSIX Network Level Module Audit
  264. 196    dn6-nlm-red - DNSIX Session Mgt Module Audit Redir
  265. 197    dls - Directory Location Service
  266. 198    dls-mon - Directory Location Service Monitor
  267. 199    smux
  268. 200    src - IBM System Resource Controller
  269. 201    at-rtmp - AppleTalk Routing Maintenance
  270. 202    at-nbp - AppleTalk Name Binding
  271. 203    at-3 - AppleTalk Unused
  272. 204    at-echo - AppleTalk Echo
  273. 205    at-5 - AppleTalk Unused
  274. 206    at-zis - AppleTalk Zone Information
  275. 207    at-7 - AppleTalk Unused
  276. 208    at-8 - AppleTalk Unused
  277. 209    tam - Trivial Mail Authentication Protocol
  278. 210    z39.50
  279. 211    914c/g - Texas Instruments 914C/G Terminal
  280. 212    anet - ATEXSSTR
  281. 213    ipx
  282. 214    vmpwscs - VM PWSCS
  283. 215    softpc - Insignia Solutions
  284. 216    atls - Access Technology License Server
  285. 217    dbase - dBASE Unix
  286. 218    mpp - Netix Message Posting Protocol
  287. 219    uarps - Unisys ARPs
  288. 220    imap3 - Interactive Mail Access Protocol v3
  289. 221    fln-spx - Berkeley rlogind with SPX auth
  290. 222    rsh-spx - Berkeley rshd with SPX auth
  291. 223    cdc - Certificate Distribution Center
  292. 243    sur-meas - Surveet Measurement
  293. 245    link
  294. 246    dsp3270 - Display Systems Protocol
  295. 344    pdap - Prospero Data Access Protocol
  296. 345    pawserv - Perf Analysis Workbench
  297. 346    zserv - Zebra server
  298. 347    fatserv - Fatmen Server
  299. 348    csi-sgwp - Cabletron Management Protocol
  300. 371    clearcase
  301. 372    ulistserv - Unix Listserv
  302. 373    legent-1 - Legent Corporation
  303. 374    legent-2 - Legent Corporation
  304. 375    hassle
  305. 376    nip - Amiga Envoy Network Inquiry Proto
  306. 377    tnETOS - NEC Corporation
  307. 378    dsETOS - NEC Corporation
  308. 379    is99c - TIA/EIA/IS-99 modem client
  309. 380    is99s - TIA/EIA/IS-99 modem server
  310. 381    hp-collector - hp performance data collector
  311. 382    hp-managed-node - hp performance data managed node
  312. 383    hp-alarm-mgr - hp performance data alarm manager
  313. 384    arns - A Remote Network Server System
  314. 385    ibm-app - IBM Application
  315. 386    asa - ASA Message Router Object Def.
  316. 387    aurp - AppleTalk Update-Based Routing Pro.
  317. 388    unidata-ldm - Unidata LDM Version 4
  318. 389    ldap - Lightweight Directory Acess Protocol
  319. 390    uis
  320. 391    synotics-relay - SynOptics SNMP Relay Port
  321. 392    synotics-broker - SynOptics Port Broker Port
  322. 393    dis - Data Interpretation System
  323. 394    embl-ndt - EMBL Nucleic Data Transfer
  324. 395    NETscout Control Protocol
  325. 396    netware-ip - Novell Netware over IP
  326. 397    mptn - Multi Protocol Trans. Net.
  327. 398    kryptolan
  328. 400    work-sol - Worksation Solutions
  329. 401    ups - Uninteruptible Power Supply
  330. 402    genie - Genie Protocol
  331. 403    decap
  332. 404    nced
  333. 407    timbuktu
  334. 408    prm-sm - Prospero Resource Manager Sys. Man.
  335. 409    prm-nm - Prospero Resource Manager Node Man.
  336. 410    decladebug - DECLadebug Remote Debug Protcol
  337. 411    rmt - Remote MT Protocol
  338. 412    synoptics-trap - Trap Convetion Port
  339. 413    smsp
  340. 414    infoseek
  341. 415    bnet
  342. 416    silverplatter
  343. 417    onmux
  344. 418    hyper-g
  345. 419    ariel1
  346. 420    smpte
  347. 421    ariel2
  348. 422    ariel3
  349. 423    opc-job-start - IBM Operations Planning and Control Start
  350. 424    opc-job-track - IBM Operations Planning and Control Track
  351. 425    icad-el - ICAD
  352. 426    smartsdp
  353. 427    svrloc - Server Location
  354. 428    ocs_cmu
  355. 429    ocs_amu
  356. 430    utmpsd
  357. 431    utmpcd
  358. 432    iasd
  359. 433    nnsp
  360. 434    mobileip-agent
  361. 435    mobileip-mn
  362. 436    dna-cml
  363. 437    comscm
  364. 438    dsfgw
  365. 439    dasp
  366. 440    sgcp
  367. 441    decvms-sysmgt
  368. 442    cvc_hostd
  369. 443    https
  370. 444    snpp - Simple Network Paging Protocol
  371. 445    microsoft-ds
  372. 446    ddm-rdb
  373. 447    ddm-dfm
  374. 448    ddm-byte
  375. 449    as-servermap - AS Server Mapper
  376. 450    tserver
  377. 497    retrospect - Retrospect Backup software
  378. 515    printer - spooler
  379. 517    talk
  380. 518    ntalk
  381. 525    timed - timeserver
  382. 526    tempo - newdate
  383. 548    AppleShare IP Server
  384. 3000    First Class Server
  385. 5500    Hotline Server
  386. 5501    Hotline Server
  387. 8080    http
  388.  
  389. [Most all of the remaining ports are mentioned to be unused or unregistered (Keep in mind that the largest anonymous port in most tcp software is 65535)]
  390.  
  391. IP - Internet Protocol.  IP takes care of addressing.  You have probably heard of the term ‘IP Address’: this is the Internet Protocol in use.  Every Internet Service Provider assigns you an IP address once you log on; for ethernet usage this is much like DHCP.
  392.  
  393. ARP - Address Resolution Protocol.  ARP finds out what Joe’s Hardware address is, or what Mary’s NICA is. It also resolves IP addresses and many other things such as MAC addresses or Physical hardware addresses. ARP relies on IP to work properly.
  394.  
  395. RARP - RARP, or Reverse Address Resolution Protocol, figures out what the TCP/IP address is via the Network Interface Card.
  396.  
  397. ICMP - Internet Control Message Protocol.  ICMP packets are used to determine flaws or problems within two or more hosts.  An example: If I ping joe but joe doesnt respond, then it means joe’s box is down.  However if he replies to the ICMP_ECHO_REPLY flag stated in the packet, it would mean his box was actually up.  ICMP can also be used to ping flood someone, as you already know.
  398.  
  399. LDAP - Lightweight Directory Access Protocol.  LDAP is used (much like FINGER) to look up information on an X.500 directory service.  LDAP can be used to retrieve email addresses, phone numbers, and other information that might be useful to someone who has access to a X.500 directory service.
  400.  
  401. BootP - Boot Protocol.  BootP lets you boot your OS from a remote machine connected to a network.  It is very similar to TFTP in that it uses a different computer to boot/load OS’s or applications.  BootP might be used if you were out of disk space or were having problems with your own Operating System.
  402.  
  403. TFTP - Trivial File Transfer Protocol.  TFTP is somewhat like bootp: it lets you download files or install operating systems via DEC’s remote installation service.  TFTP is primarily used to load/run applications from a TFTP server, and as stated before is extremely important for network booting.  
  404.  
  405. SMTP - Simple Mail Transfer Protocol. SMTP is one of the most widely used protocols today: it handles internet e-mail messaging and supports the tranfer of files from one computer to another.  The whole E-mail system is based on SMTP; you need an SMTP server to send/recieve messages.  SMTP is peticularly unsafe because it lets you ‘spoof’ messages from one address to another.  In this example, we connect to a host running sendmail on port 25, and enter our message headers.
  406.  
  407. 220 driftwood.nfth.com ESMTP Sendmail 8.8.7/8.8.7; Thu, 15 Oct 1998 20:20:42 -0400
  408.  
  409. HELO blah
  410. 250 driftwood.nfth.com Hello techlib.org [199.227.254.193], pleased to meet you
  411.  
  412. RSET
  413. 250 Reset state
  414.  
  415. MAIL FROM: <owned@nfth.com>
  416. 250 <owned@nfth.com>... Sender ok
  417.  
  418. RCPT TO:<recieve@desthost.com>
  419. 550 recieve@desthost.com>....ok
  420.  
  421. The rest of the part is pretty simple, just do DATA and then QUIT.
  422.  
  423. UDP - User Datagram protocol.  UDP is a bare-bones connectionless protocol used peticularly for DNS servers.  UDP is different from TCP because it doesnt require any control packets to be sent before a connection is esatblished.  Unlike TCP, UDP does not check for errors: this means that if something goes wrong UDP will not correct it.  Applications like AOL (bleh) have its own error correction built in, so that MOST of the data sent/recieved can be successfully transfered between computers.  UDP is dependent on IP, which is used to reliably ‘deliver’ the packets to the upper-layer applications defined in the OSI model(figure 1).  To create a datagram socket, use this:(You need alot more than this to actually get the socket working)
  424.  
  425. socket(AF_INET, SOCK_DGRAM, 0)
  426.  
  427. SOCK_DGRAM specifies that the socket type will be datagram, not stream.
  428.  
  429. f1:
  430. -International Standards Organization OSI Model-
  431.  
  432. --------------------------------------
  433.                                                 Application
  434. --------------------------------------
  435.                                                 Presentation
  436. --------------------------------------
  437.                                                 Session
  438. --------------------------------------
  439.                                                 Transport
  440. --------------------------------------
  441.                                                 Network
  442. --------------------------------------
  443.                                                 Data Link
  444. --------------------------------------
  445.                                                 Physical
  446. --------------------------------------
  447.  
  448. Physical  - Hardware, as in modem or NIC.
  449.  
  450. Data Link - Handles error correction from interference produced by the physcal devices such as network-related wiring.  The Data Link also helps ‘construct’ the packets sent by applications and send them using IP to use the correct address.
  451.  
  452. Network  - This layer interacts with the Data Link layer to send the packets to the specified address.
  453.  
  454. Transport - The Transport layer makes sure that no errors occur between the routing of packets constructed by the Data Link.
  455.  
  456. Session - This layer simply handles the connection between two addresses.
  457.  
  458. Presentation - Handles file formatting that is used with various clients.  For example, without the Presentation layer you would not be able to send a file in Binary format without knowing that the other computer would be able to run it.
  459.  
  460. Application - This layer handles use of applications that are dependent on the OSI model, like telnet or FTP.
  461.  
  462. -end International Standards Organization OSI Model-
  463.